package cn.wolfcode.crm.query;

import cn.wolfcode.crm.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
public class SignObjectQuery extends ObjectQuery {

    private String keyword;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;
    public String getKeyword() {
        if (keyword != null && "".equals(keyword.trim())) {
            return null;
        }
        return keyword;
    }

    //得到日期的最后一秒
    public Date getBeginDate(){
        if(beginDate!=null){
            return DateUtil.getEndDate(beginDate);
        }
        return beginDate;
    }
    public Date getEndDate(){
        if(endDate!=null){
            return DateUtil.getEndDate(endDate);
        }
        return endDate;
    }
}
